<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/includes.jsp" %>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>采购订单编辑</title>
	<%@ include file="/common/metaInput.jsp" %>  
	<script src="${ctx}/js/jsp/comm.js" type="text/javascript"></script>
	<script type="text/javascript" src="${ctx}/js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">
var basic_Url="${ctx}/logic/purchase";
var grid;
$(function(){
	// 供应商
	 $("#zd002SupeId").change(function(){
		 	grid.loadData();
		 	$("#zd003ZhName").val("");
    		$("#zd010Email").val("");
			$("#zd006Contacts").val("");
			$("#zd008Phone").val("");
			$("#zd007Tel").val("");
			$("#zd011Fax").val("");
			$("#zd011Fax").val("");
			if(''!= $(this).val()){
				$.ajax({
	    		      url: basic_Url+"/getGysInfo.do",
	    		      global: false,
	    		      type: "POST",
	    		      dataType: "json",
	    		      data: ({
	    		    	  gysId : $(this).val()
	    		      }),		     
	    		      success: function(msg){
	    		    	if(undefined != msg && undefined != msg.gys && null != msg.gys){
	    		    		$("#zd003ZhName").val(msg.gys.zd003ZhName);
	    		    		$("#zd010Email").val(msg.gys.zd010Email);
	    					$("#zd006Contacts").val(msg.gys.zd006Contacts);
	    					$("#zd008Phone").val(msg.gys.zd008Phone);
	    					$("#zd007Tel").val(msg.gys.zd007Tel);
	    					$("#zd011Fax").val(msg.gys.zd011Fax);
	    					$("#zd011Fax").val(msg.gys.zd011Fax);
	    		    	}else{
	    		    		alert("返回对象为空");
	    		    	}
	    	   			
	    		      }
	    	   });
			}
		});
	 
	 
	 //汇率
	 $("#zd003CurrencyId").change(function(){
		 grid.loadData();
		 $("#zd004Exchange").val("");
		 var currencyId = $(this).val();
		 if(currencyId!=''&&currencyId!=null){
			 $.ajax({
			     url: basic_Url+"/getCurrencyInfo.do",
			     global: false,
			     type: "POST",
			     dataType: "json",
			     data: ({
			         currencyId : $(this).val()
			     }),		     
			     success: function(data){
			      	if(undefined != data && undefined != data.currency && null != data.currency){
						$("#zd004Exchange").val(data.currency.zd003CurrencyRate);
			    	}else{
			    		alert("返回对象为空");
			    	}
			     }
		    });
		 }
	 }); 
	 
	 var column1 =  [{ display: 'id', name: 'id', width: 1,hide: true },
    				 { display: 'zd002MaterId', name: 'zd002MaterId', width : 1,hide:true},
    				 { display: '<font color="gray">物料编码</font>', name: 'zd003Code', width: 100 },
                     { display: '<font color="gray">物料名称</font>', name: 'zd004Name', width: 150 },
                     //{ display: '<font color="gray">物料规格</font>', name: 'zd005Spec', width: 150 },
                     { display: '产品型号<font color="red">*</font>', name: 'zd006Model', width: 100,editor: { type: 'text'}},
   				  	 { display: '产品尺寸<font color="red">*</font>', name: 'zd023Size', width: 100,editor: { type: 'text'}},
   				     { display: '产品颜色<font color="red">*</font>', name: 'zd021Color', width: 80,editor: { type: 'text'}},
   				     { display: '产品材质<font color="red">*</font>', name: 'zd022Quality', width: 160,editor: { type: 'text'}},
                     { display: '单位<font color="red">*</font>', name: 'zd009Unit', width: 80 },
                     { display: '数量<font color="red">*</font>', name: 'zd011Quatity', width: 120,editor: { type: 'float'},render:function(item){
                    	 return (item.zd011Quatity==undefined ? 0:(1*item.zd011Quatity).toFixed(4));
                     }},
                     { display: '单价', name: 'zd012Price', width: 120,editor: { type: 'float'},render:function(item){
                    	 var price = item.zd012Price;//单价
                    	 if(isNaN(price)||price==null||price==undefined){
                    		 return "0";
                    	 }
                    	 return (1*price).toFixed(4);
                     }},
                     { display: '描述', name: 'zd025Descript', width: 160, editor: { type: 'text'} }
                     ];
                	 	
	var column2 = [{ display: 'id', name: 'id', width: 1,hide: true },
  				 { display: 'zd002MaterId', name: 'zd002MaterId', width : 1,hide:true},
				 { display: '<font color="gray">物料编码</font>', name: 'zd003Code', width: 100 },
                 { display: '<font color="gray">物料名称</font>', name: 'zd004Name', width: 150 },
                 //{ display: '<font color="gray">物料规格</font>', name: 'zd005Spec', width: 150 },
                 { display: '产品型号<font color="red">*</font>', name: 'zd006Model', width: 100 },
				 { display: '产品尺寸<font color="red">*</font>', name: 'zd023Size', width: 100 },
				 { display: '产品颜色<font color="red">*</font>', name: 'zd021Color', width: 80 },
				 { display: '产品材质<font color="red">*</font>', name: 'zd022Quality', width: 160,editor: { type: 'text'}},
                 { display: '单位<font color="red">*</font>', name: 'zd009Unit', width: 80 },
                 { display: '数量<font color="red">*</font>', name: 'zd011Quatity', width: 120 },
                 { display: '单价<font color="red">*</font>', name: 'zd012Price', width: 160 },
                 { display: '描述', name: 'zd025Descript', width: 150 }
                 ];
    var column3 = null;   
   //按钮可见
	var billState = '${purchase.zd011Status}';//单据的状态
	if(''==billState && 'ADD'=='${flag}'){
		//新增
		column3 = column1;
	}else{
		if('PHS_SAVE'==billState||'PHS_BACK'==billState){
			column3 = column1;
	    }else{
	    	column3 = column2;
	    }
	}
	var griddata ={};
	grid = $("#table1").ligerGrid({
				  columns: column3,
                  enabledEdit: true,
                  usePager: true,pageSize:1000,pageSizeOptions:[1000],
                  parms:[{ name : 'id' , value : '${purchase.id}'}],
                  url : basic_Url+"/gridItems.do",
                  width: "100%", height:'90%', checkbox: true,
                  toolbar: { items: [{ text: '添加物料', click: ItemWindow, icon: 'add'},
                                     { line: true },
                                     { text: '复制物料', click: addWindow, icon: 'add'},
                                     { line: true },
                                     { text: '删除', click: deleteRow, img: '${ctx}/js/ligerUI/skins/icons/delete.gif' }
                             ]}
                  });
	$("#pageloading").hide();

	$("#inputForm").validate({			   
		onsubmit: true,
	 	/*执行ajaxsubmit  */ 
	    submitHandler: function(editform) {
	        try{			    		
	            url =  basic_Url+"/save.do";
	            var api = frameElement.api;
	        	var W = api.opener;
	        	getReturnMessage(basic_Url+"/save.do","inputForm",W.searchAP);
	        }catch(e){alert(e);}
	    }
	});
	
	if(''==billState && 'ADD'=='${flag}'){
		//新增
		$("#forTwoSave").hide();
		$("#forSubmit").hide();
		$("#forTwoEnd").hide();
		$("#forThreeSave").hide();
		$("#forBack").hide();
		$("#forEnd").hide();
		$("#forExport").hide();
	}else if(billState == 'PHS_SAVE'){
		//表示待提交,则只能看到提交/关闭按钮
		$("#forSave").hide();
		$("#forTwoSave").hide();
		$("#forTwoEnd").hide();
		$("#forThreeSave").hide();
		$("#forBack").hide();
		$("#forEnd").hide();
		$("#forExport").hide();
	}else if(billState == 'PHS_SUBMIT'){
		//表示已提交,带审核,则
		$("#forSave").hide();
		$("#forSubmit").hide();
		$("#forThreeSave").hide();
		$("#forEnd").hide();
		$("#forExport").hide();
	}else if(billState == 'PHS_AUDIT'){
		//表示已初审,待二级审核,则只能看到审核
		$("#forSave").hide();
		$("#forSubmit").hide();
		$("#forTwoSave").hide();
		$("#forTwoEnd").hide();
		$("#forEnd").hide();
		$("#forExport").hide();
	}else if(billState == 'PHS_APPROVE'){
		//表示已初审,待二级审核,则只能看到审核
		
		$("#forSave").hide();
		$("#forSubmit").hide();
		$("#forTwoSave").hide();
		$("#forTwoEnd").hide();
		$("#forBack").hide();
		$("#forThreeSave").hide();
		$("#forEnd").hide();
		$("#forExport").hide();
	}else if(billState=='PHS_BACK'){
		$("#forSave").hide();
		$("#forTwoSave").hide();
		$("#forTwoEnd").hide();
		$("#forThreeSave").hide();
		$("#forBack").hide();
		$("#forEnd").hide();
		$("#forExport").hide();
	}
});

	//选择物料
	function ItemWindow(){
		var zdState = '${purchase.zd011Status}';
		if(zdState =='PHS_SUBMIT'||zdState == "PHS_APPROVE"){
			$.dialog.alert("已提交或者正在审核的单据不能新增物料!");
			return false;
		}else if($("#zd002SupeId").val() == null || $("#zd002SupeId").val()==""){
			$.dialog.alert("您还没有选择供应商,请先选择供应商!");
			return false;
		}else{
			getDG().dialog({
				title : '选择材料',
				width : 650,
				height : 350,
				content : 'url:' + sys_context+ '/public/windowalert/itemmanager.do',//
				lock : true,
				max : true,
				min : true,
				ok : function() {
					var getSelectedHub = this.content.getSelected();
					var manager = $("#table1").ligerGetGridManager();
					if (getSelectedHub != null) {
						$(getSelectedHub).each(function(){
			                manager.addRow2({
			                	zd002MaterId : this.id,
			                	zd003Code : this.zd001Code,
			                	zd004Name : this.zd002Name,
			                	zd006Model : this.zd004Model,
			                	zd023Size : this.zd026Size,
			                	zd021Color : this.zd033Color,
			                	zd022Quality : this.zd034Quality,
			                	zd005Spec : '',
			                	zd012Price : this.zd009Price,
			                	zd009Unit : this.basicStapleUnitDO.zd002Name,
			                	zd025Descript : this.zd006Description
		                	});
						});
						this.content.Close();
					}
					return false;
				},
				cancelVal : '关闭',
				cancel : true
			}).zindex();
		}
	}

	//复制物料
	function addWindow(){
		var cRows = grid.getCheckedRows();
		if(cRows.length==0){
			$.dialog.alert("请选择要复制的物料行！");
			return false;
		}
		var manager = $("#table1").ligerGetGridManager();
		for(var i=0; i<cRows.length;i++){
			manager.addRow({
				zd002MaterId : cRows[i].zd002MaterId,
				zd003Code : cRows[i].zd003Code,
				zd004Name : cRows[i].zd004Name,
				zd006Model : cRows[i].zd006Model,
				zd023Size : cRows[i].zd023Size,
				zd021Color : cRows[i].zd021Color,
				zd022Quality : cRows[i].zd022Quality,
				zd009Unit : cRows[i].zd009Unit,
				zd011Quatity : cRows[i].zd011Quatity==null?0:cRows[i].zd011Quatity,
				zd012Price : cRows[i].zd012Price,
				zd025Descript : cRows[i].zd025Descript
			});
		}
	}
	function exportExcel(){
		var id=$("#id").val();
		if(id!=""&&"${purchase.zd019OrderDate}"!="PHS_SAVE"&&"${purchase.zd019OrderDate}"!="PHS_BACK"){
			var path = basic_Url+"/exportExcel.do?id="+id;
	   		window.open(path,"_blank");
		}
		else{
			$.dialog.alert("请提交之后再进行导出");
		}
	}

	function exportAP(){
		var id=$("#id").val();
		if(id!=""&&"${purchase.zd019OrderDate}"!="PHS_SAVE"&&"${purchase.zd019OrderDate}"!="PHS_BACK"){
			var path = basic_Url+"/exportExcel.do?id="+id;
	   		window.open(path,"_blank");
		}
		else{
			$.dialog.alert("请提交之后再进行导出");
		}
	}
	//复制物料
	function addWindow(){
		var cRows = grid.getCheckedRows();
		if(cRows.length==0){
			$.dialog.alert("请选择要复制的物料行！");
			return false;
		}
		var manager = $("#table1").ligerGetGridManager();
		for(var i=0; i<cRows.length;i++){
			manager.addRow({
				zd002MaterId : cRows[i].zd002MaterId,
				zd003Code : cRows[i].zd003Code,
				zd004Name : cRows[i].zd004Name,
				zd006Model : cRows[i].zd006Model,
				zd023Size : cRows[i].zd023Size,
				zd021Color : cRows[i].zd021Color,
				zd022Quality : cRows[i].zd022Quality,
				zd009Unit : cRows[i].zd009Unit,
				zd011Quatity : cRows[i].zd011Quatity==null?0:cRows[i].zd011Quatity,
				zd012Price : cRows[i].zd012Price,
				zd025Descript : cRows[i].zd025Descript
			});
		}
	}

	function deleteRow()
	{ 
		grid.deleteSelectedRow();
	}
	
	function submitForm(param) {
		//设置ajax全局同步
		var data = grid.getData();
		var arr= new Array();
		var br=false;
		for(var i=0;i<data.length;i++){
			var key=data[i].zd004Name+"_"+data[i].zd003Code+"_"+data[i].zd006Model+"_"+data[i].zd023Size+"_"+data[i].zd021Color+"_"+data[i].zd022Quality;
			arr[i]=key;
			for(var j = 0 ;j<i;j++){
				if(arr[j]==key){
					$.dialog.alert("数据错误,您的第"+(i+1)+"和第"+(j+1)+"条的物品是同一物品,请确认后提交");
					br=true;
					break;
				}			
			}
			if(br){
				return false;
				break;
			}
		}
		
		var dl = grid.getDeleted();
		if (data.length == 0) {
			$.dialog.alert("请选择申请物料");
			return false;
		}
		var ba = true;
		if (data != null) {
			var i = 0;
			$(data).each(function() {
				i++;
				if (this.zd009Unit=="" ||this.zd009Unit==undefined ||this.zd009Unit==null) {
					$.dialog.alert("您第" + i + "行单位没有填写");
					ba = false;
					return false;
				}
				if (isNaN(this.zd011Quatity) ||this.zd011Quatity==undefined ||this.zd011Quatity==null) {
					$.dialog.alert("您第" + i + "行数量没有填写");
					ba = false;
					return false;
				}
				if (parseInt(this.zd011Quatity)<=0) {
					$.dialog.alert("您第" + i + "行数量不能小于或为0");
					ba = false;
					return false;
				}
			});
		}
		jQuery.ajaxSettings.async = false;
		var str="";
		if(param=='PHS_APPROVE'){
			str="是否审核完结请选择(Yes或者No)!";
		}else if(param=='PHS_END'){
			str="是否完结订单请选择(Yes或者No)!";
		}
		if(param=='PHS_APPROVE' || param=='PHS_END'){
			getDG().dialog({content: str,width: 250,lock: true,max: false,min: false,
				title:'Confirm Infor',
				button: [{
					name: 'Yes',
				    callback: function(){
					    if(ba){
					    	$("#flag").val(param);
					        $("#itemdata").val(JSON.stringify(data));
					        $("#itemdelete").val(JSON.stringify(dl));
					        $("#inputForm").submit();
					    }
					}
				},{
					name: 'No',
		        	focus: true
		        }]
			}).zindex();
		}else{
			if (ba) {
				$("#flag").val(param);
				$("#itemdata").val(JSON.stringify(data));
				$("#itemdelete").val(JSON.stringify(dl));
				$("#inputForm").submit();
			}
		}
		
	}
	//供应商
function CompanyWindow() {
	getDG().dialog(
			{
				title : '选择供应商',
				width : 650,
				height : 350,
				content : 'url:' + sys_context + '/public/windowalert/company.do?zdType='+" ",    
				lock : true,
				max : true,
				min : true,
				ok : function() {
					var rows = this.content.getSelected();
					if(rows==null){
						$.dialog.alert("请选择数据");
						return;
					}
					else{
						if(rows.length>1){
							$.dialog.alert('只能选择一行数据!');
							return;
						}else{
							$(rows).each(function() {
								$("#zd002SupeCode").val(this.zd001Code);
								$("#zd002SupeId").val(this.id);
								$("#zd003ZhName").val(this.zd003ZhName);
								$("#zd006Contacts").val(this.zd006Contacts);
								$("#zd007Tel").val(this.zd007Tel);
								$("#zd008Phone").val(this.zd008Phone);
								$("#zd005ZhDesp").val(this.zd005ZhDesp);
								$("#zd010Email").val(this.zd010Email);
								$("#zd011Fax").val(this.zd011Faxs);
								$("#zd023Address").val(this.zd023Address);
								
						  });
						}
					}
					this.content.Close();
					return false;
				},
				cancelVal : '关闭',
				cancel : true
			}).zindex();
}

//币种
function CurrencyWindow() {
	getDG().dialog(
			{
				title : '选择币种',
				width : 650,
				height : 350,
				content : 'url:' + sys_context + '/public/windowalert/currency.do',    
				lock : true,
				max : true,
				min : true,
				ok : function() {
					var rows = this.content.getSelected();
					if(rows==null){
						$.dialog.alert("请选择数据");
						return;
					}
					else{
						if(rows.length>1){
							$.dialog.alert('只能选择一行数据!');
							return;
						}else{
							$(rows).each(function() {
								$("#zd004Exchange").val(this.zd003CurrencyRate);
								$("#zd003CurrencyId").val(this.id);
								$("#zd001CurrencyName").val(this.zd001CurrencyName);
								
						  });
						}
					}
					
					this.content.Close();
					return false;
				},
				cancelVal : '关闭',
				cancel : true
			}).zindex();
}
//支付方式
function PayModelWindow(){
	getDG().dialog({
		title : '选择币种',
		width : 650,
		height : 350,
		content : 'url:' + sys_context + '/public/windowalert/paymodel.do',    
		lock : true,
		max : true,
		min : true,
		ok : function() {
			var rowSel = this.content.getSelected();
			if(rowSel==null){
				$.dialog.alert('请选择数据!');
				return;
			}else{
				if(rowSel.length>1){
					$.dialog.alert('只能选择一行数据!');
					return;
				}else{
					$(rowSel).each(function() {
						$("#zd005PayId").val(this.id);
						$("#zd005PayCode").val(this.zd001Code);
						$("#zd005PayName").val(this.zd002Name);
					});
				}
			}
			this.content.Close();
			return false;
		},
		cancelVal : '关闭',
		cancel : true
	}).zindex();
}
function DeptListWindow(){
	getDG().dialog({
		title : '选择部门',
		width : 650,
		height : 350,
		content : 'url:' + sys_context + '/public/windowalert/deptItem.do',    
		lock : true,
		max : true,
		min : true,
		ok : function() {
			var rowSel = this.content.getSelected();
			if(rowSel==null){
				$.dialog.alert('请选择数据!');
				return;
			}else{
				if(rowSel.length>1){
					$.dialog.alert('只能选择一行数据!');
					return;
				}else{
					$(rowSel).each(function() {
						$("#zd008DeptId").val(this.id);
						$("#zd009DeptCode").val(this.depcode);
						$("#zd010DeptName").val(this.depname);
					});
				}
			}
			this.content.Close();
			return false;
		},
		cancelVal : '关闭',
		cancel : true
	}).zindex();
}
function getCustomer(){
	var pi=$("#zd012PiCode").val();
	if(pi==""){//为空时是备货
		return;
	}
	$.ajax({
		url:"${ctx}/logic/sales/getCustomer.do",
		global: false,
		type:"POST",
		dataType:"json",
		data:({"picode":pi}),
		 success: function(msg){
	    	  if(msg.msg=="success"){
					$("#zd022AccountID").val(msg.customerId);
					$("#zd022AccountName").val(msg.customerName);
					$("#zd022AccountCode").val(msg.customerCode);
				}else{
					$("#zd022AccountID").val("");
					$("#zd022AccountName").val("");
					$("#zd022AccountCode").val("");
					if(msg.msg==0){
						$.dialog.alert("这个PI号不存在，或者含有此PI号的销售订单没有保存");
					}else{
						$.dialog.alert("PI号出现重复，请检查确认后重新出入");
					}
				}
	   }
	});
}

</script>

</head>

<body>

<form id="inputForm" action="" method="post">
<input type="hidden" id="id" name="id" value="${purchase.id}"/>
<input type="hidden" id="bizVersion" name="bizVersion" value="${purchase.bizVersion}"/>
<input type="hidden" id="itemdata" name="itemdata" value=""/>
<input type="hidden" id="itemdelete" name="itemdelete" value=""/>
<input type="hidden" id="flag" name="flag" value=""/>
<!-- 用于标识提交按钮 -->
<input type="hidden" id="submitFlag" value="" />
 <div class="pageContent" >
    <div class="panel" >
         <table class="TableBlock" align="center">
   		 	<tr>
   		 		<c:if test="${not empty purchase.zd020Code }">
	            	<td>采购编号:</td>
		            <td>
		            	<input type="text"  id="zd020Code" name="zd020Code"  class="required inp_width_98p" value="${purchase.zd020Code}" />
	   		        </td>
	   		        <td colspan="2">
		            	
	   		        </td>
   		        </c:if>
   		    </tr>
   		    <tr>
   		    	<td>供应商编号:</td>
				<td>  
				    <input type="text" style="width:200px;" id="zd002SupeCode" name="zd002SupeCode" value=" ${comp.zd001Code}" ></input>
					<input type="hidden" style="width:200px;" id="zd002SupeId" name="zd002SupeId" value="${comp.id}"></input>
   		        	<input type="button" value="..." onclick="CompanyWindow();" />
   		           		</td>
				<td>PI编号:</td>
	            <td>
	            	<input type="text" id="zd012PiCode"  onchange="getCustomer()" name="zd012PiCode" class="inp_width_98p" value="${purchase.zd012PiCode }"/>
	            </td>
   		    </tr>
   		     <tr>
   		    	<td>客户编号:</td>
				<td>  
				    <input type="text" style="width:200px;" id="zd022AccountCode" name="zd022AccountCode" value=" ${purchase.zd022AccountCode}"   ></input>
				    <input type="hidden" style="width:200px;" id="zd022AccountID" name="zd022AccountID" value="${purchase.zd022AccountID}"  ></input>
   		           		</td>
				<td>客户名称:</td>
	            <td>
	            	<input type="text" id="zd022AccountName" name="zd022AccountName" class="inp_width_98p" value="${purchase.zd022AccountName }" />
	            </td>
   		    </tr>
			<tr>
  		    	<td>供应商名称:</td>
  		        <td><input type="text"  id="zd003ZhName" class="inp_width_98p"  value="${comp.zd003ZhName }"  readonly="readonly"/></td>
				<td>邮箱:</td>
  		        <td><input type="text"  id="zd010Email" class="inp_width_98p"  value="${comp.zd010Email }"  readonly="readonly"/></td>
			</tr>
			<tr>
			 	 <td>联系人:</td>
           		 <td><input type="text"  id="zd006Contacts" class="inp_width_98p"  value="${comp.zd006Contacts }"  readonly="readonly"/></td>    
                 <td>手机:</td>
           		 <td><input type="text"  id="zd008Phone" class="inp_width_98p"  value="${comp.zd008Phone }"  readonly="readonly"/></td>
			</tr>
			<tr>
			 	 <td>电话:</td>
           		 <td><input type="text"  id="zd007Tel" class="inp_width_98p" value="${comp.zd007Tel }"  readonly="readonly"/></td>    
                 <td>传真:</td>
           		 <td><input type="text"  id="zd011Fax" class="inp_width_98p"  value="${comp.zd011Fax }"  readonly="readonly"/></td>
			</tr>
			<tr>
			 	 <td>地址:</td>
 		         <td colspan="3"><input type="text"  id="zd023Address" class="inp_width_98p"  value="${comp.zd023Address }"  readonly="readonly"/></td>    
			</tr>
           	<tr>
             	<td>采购方式:</td>
	           	<td>
	           		<select id="zd018BuyWay" class="required inp_width_98p" name="zd018BuyWay" >
	           			<option></option>
	           			<option>赊购</option>
	           			<option>现购</option>
	           		</select>
	           		<script type="text/javascript">
	           			$("#zd018BuyWay").val('${purchase.zd018BuyWay}');
	           		</script>
	           	</td>
		        <td>摘要:</td>
           		<td><input type="text"  id="zd007Tabloid" name="zd007Tabloid"  class="inp_width_98p" value="${purchase.zd007Tabloid}" /></td>
           </tr>
           <tr>
           		<td>订购日期:</td>
           	  	<td>
                 	<input type="text" id="zd019OrderDate" class="required inp_width_98p" readonly="readonly" name="zd019OrderDate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})"
						value="<fmt:formatDate value="${purchase.zd019OrderDate}" pattern="yyyy-MM-dd" type="both" />" />
                 </td>
           		<td>收货日期:</td>
           	  	<td>
                 	<input type="text" id="zd021AcceptDate" class="inp_width_98p" readonly="readonly" name="zd021AcceptDate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})"
						value="<fmt:formatDate value="${purchase.zd021AcceptDate}" pattern="yyyy-MM-dd" type="both" />" />
                </td>
           	</tr>
           	<tr>
           		<td>币种:</td>
           		<td>	
   				    <input type="hidden" style="width:200px;" id="zd003CurrencyId"  name="zd003CurrencyId" value="${purchase.zd003CurrencyId }" ></input>
   				    <input type="text" style="width:200px;" id="zd001CurrencyName" value="${curr.zd001CurrencyName }" ></input>
   					<input type="button" value="..." onclick="CurrencyWindow();" />
           		</td>
           		<td>汇率:</td>
           		<td><input type="text"  id="zd004Exchange" name="zd004Exchange" class="np_width_98p" value="${purchase.zd004Exchange}" readonly="readonly"/></td>
           	</tr>
   		    <tr>
   		    	<td>支付方式:</td>
   		        <td>
   		        	<input type="hidden" style="width:200px;" id="zd005PayId"  name="zd005PayId" value="${purchase.zd005PayId }" />
   		        	<input type="hidden" style="width:200px;" id="zd005PayCode"  name="zd005PayCode" value="${purchase.zd005PayCode }" />
   				    <input type="text" style="width:200px;" id="zd005PayName" name="zd005PayName" value="${purchase.zd005PayName }" ></input>
   					<input type="button" value="..." onclick="PayModelWindow();" />
   		        </td>
   		        <td>部门：</td>
   		        <td>
            		<input type="hidden" style="width:200px;" id="zd008DeptId"  name="zd008DeptId" value="${purchase.zd008DeptId }" />
   		        	<input type="hidden" style="width:200px;" id="zd009DeptCode"  name="zd009DeptCode" value="${purchase.zd009DeptCode }" />
   				    <input type="text" style="width:200px;" id="zd010DeptName" name="zd010DeptName" value="${purchase.zd010DeptName }" ></input>
   					<input type="button" value="..." onclick="DeptListWindow();" />
            	</td>
   		    </tr>
            <tr>
            	<td>备注:</td>
           		<td><input  id="zd017Remark" name="zd017Remark" value="${purchase.zd017Remark}"  class="inp_width_98p"/></td>
          	</tr>
        </table>
        <div id="table1"> </div>               
   	</div>
		<div class="formBar">
	        <ul>
		       <li><div class="buttonActive"><div class="buttonContent"><button type="button" id="forSave" onclick="submitForm('PHS_SAVE')">保存</button></div></div></li>
		       <li><div class="buttonActive"><div class="buttonContent"><button type="button" id="forSubmit" onclick="submitForm('PHS_SUBMIT')">提交</button></div></div></li>
		        <li><div class="button"><div class="buttonContent"><button type="button" class="export" onclick="exportAP()">导出</button></div></div> </li>
		        <li><div class="buttonActive"><div class="buttonContent"><button type="button" id="forEnd" onclick="submitForm('PHS_END')">完结订单</button></div></div></li>
		       <webres:displaycontroller elementId="CGDD_BH_CHEECK_PH" description="采购订单申请驳回">
		       		<li><div class="buttonActive"><div class="buttonContent"><button type="button" id="forBack" onclick="submitForm('PHS_BACK')">驳回</button></div></div></li>
		      	</webres:displaycontroller>
		      	 
		       <webres:displaycontroller elementId="CGDD_YJ_CHEECK" description="采购订单二级审核">
		       			<li><div class="buttonActive"><div class="buttonContent"><button type="button" id="forTwoSave" onclick="submitForm('PHS_AUDIT')">二级审核</button></div></div></li>
		       			<li><div class="buttonActive"><div class="buttonContent"><button type="button" id="forTwoEnd" onclick="submitForm('PHS_APPROVE')">二级审核完结</button></div></div></li>
		      		</webres:displaycontroller>
		      		<webres:displaycontroller elementId="CGDD_EJ_CHEECK" description="采购订单三级审核">
		       			<li><div class="buttonActive"><div class="buttonContent"><button type="button" id="forThreeSave" onclick="submitForm('PHS_APPROVE')">三级审核</button></div></div></li>
		      		</webres:displaycontroller>
		       <li><div class="button"><div class="buttonContent"><button type="button" class="print" onclick="CloseDialog()">关闭</button></div></div></li>
	        </ul>
        </div>
    </div>
</form>
</body>
</html>
